import { RouteRecordRaw } from "vue-router";
import HomeView from "@/views/User/HomeView.vue";
import ProblemView from "../views/Problem/ProblemView.vue";
import AdminView from "@/views/Admin/AdminView.vue";
import ACCESS_ENUM from "@/access/accessEnum";
import Login from "@/views/Login/Login.vue";
import Register from "@/views/Login/Register.vue";
import ModifyView from "@/views/User/ModifyView.vue";
import ForumHomeView from "@/views/Forum/HomeView.vue"
import CreatePost from "@/views/Forum/CreatePost.vue";
import PostDetail from "@/views/Forum/PostDetail.vue";  // 引入帖子详情页面
import UserModule from "@/views/Admin/UserModule.vue";
import QuestionModule from "@/views/Admin/QuestionModule.vue";
import ArticleModule from "@/views/Admin/ArticleModule.vue";
import SubmissionList from "@/views/User/SubmissionList.vue";
import RankList from "@/views/User/RankListView.vue";
import ContestList from "@/views/Contest/ContestList.vue";
export const routes: Array<RouteRecordRaw> = [
  {
    path: "/",
    name: "首页",
    component: HomeView,
  },
  {
    path: "/contest",
    name: "比赛",
    component: ContestList,
  },
  {
    path: '/contest/:id',
    name: '比赛详情',
    component: () => import('@/views/Contest/ContestDetails.vue'), // 假设比赛详情页面的组件路径
    props: true,  // 将路由参数作为 props 传递给组件
    meta: {
      access: ACCESS_ENUM.HIDDEN, // 根据需要调整访问控制
    },
  },  
  {
    path: '/contest/leaderboard/:id',
    name: '排行榜',
    component: () => import('@/views/Contest/Leaderboard.vue'), // 假设比赛详情页面的组件路径
    props: true,  // 将路由参数作为 props 传递给组件
    meta: {
      access: ACCESS_ENUM.HIDDEN, // 根据需要调整访问控制
    },
  },  
  {
    path: "/create-post",
    name: "创建帖子",
    component: CreatePost,
    meta: {
      access: ACCESS_ENUM.HIDDEN,
    },
  },
  {
    path: "/forum/:postId",  // 动态路由，postId 为帖子ID
    name: "PostDetail",
    component: PostDetail,  // 通过该组件显示帖子详情
    props: true,  // 将路由参数作为 props 传递给组件
    meta: {
      access: ACCESS_ENUM.HIDDEN,
    },
  },
  {
    path: "/problem",
    name: "题库",
    component: ProblemView,
  },
  {
    path: "/status",
    name: "状态",
    component: SubmissionList,
  },
  {
    path: "/ranklist",
    name: "排名",
    component: RankList,
  },
  {
    path: "/forum",
    name: "文章",
    component: ForumHomeView,
  },
  {
    path: '/challenge/:id',
    name: '挑战题目',
    component: () => import('@/views/Problem/ChallengePage.vue'), // Adjust this path based on your component structure
    props: true,  // 将路由参数作为 props 传递给组件
    meta: {
      access: ACCESS_ENUM.HIDDEN,
    },
  },
  {
    path: "/admin",
    name: "后台管理",
    component: AdminView,
    meta: {
      access: ACCESS_ENUM.ADMIN,
    },
  },
  {
    path: "/login",
    name: "登入",
    component: Login,
    meta: {
      access: ACCESS_ENUM.SIGNING,
    },
  },
  {
    path: "/register",
    name: "注册",
    component: Register,
    meta: {
      access: ACCESS_ENUM.SIGNING,
    },
  },
  {
    path: "/modify",
    name: "账号设置",
    component: ModifyView,
    meta: {
      access: ACCESS_ENUM.HIDDEN,
    },
  },
  {
    path: "/demo",
    name: "测试",
    component: () => import("../views/DemoView.vue"),
    meta: {
      access: ACCESS_ENUM.HIDDEN,
    }
  },
];
